#if !defined(AFX_RTCURVEDIAGRAMSURFACE_H__6D01C6B4_5639_4202_B1D7_035B84F5C50F__INCLUDED_)
#define AFX_RTCURVEDIAGRAMSURFACE_H__6D01C6B4_5639_4202_B1D7_035B84F5C50F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RTCurveDiagramSurface.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CRTCurveDiagramSurface window

#include "BaseSurface.h"

class MonitoringUnitManager;
class RealtimeRecordManager;

#define ENTIREAREA      0
#define SIGN            1
#define DROPDOWNBUTTON  2

const int kMaxNumOfRTCurves = 6;
const COLORREF kCurveColor[kMaxNumOfRTCurves] = {RGB(192, 0, 0), RGB(0, 192, 0), RGB(0, 0, 192), RGB(192, 192, 0), RGB(192, 0, 192), RGB(0, 192, 192)};

class CRTCurveDiagramSurface : public CBaseSurface
{
// Construction
public:
	CRTCurveDiagramSurface(CBasePanel * pPanel);

// Attributes
protected:
  static int m_nGDIResCounter;
  static CFont * m_pFont;

protected:
  CComboBox m_combobox;
  //MonitoringUnitManager * m_pMonitoringUnitMgr;
  std::vector<CString> m_MonUnitIds;
  int m_nFocusedCurveIndex;
  CComboBox m_cbPenWidth;
  CComboBox m_cbTime;
  CComboBox m_cbRefreshCycle;
  UINT m_nIdTimer;
  CTime m_timeEnd;
  int m_nPenWidth;
  int m_nTime;
  int m_nRefreshCycle;
  bool m_bCurveVisible[kMaxNumOfRTCurves];

// Operations
public:
  virtual bool Create(CWnd * pParentWnd);
  virtual void Paint(CDC& dc);
  virtual void UpdateDefinitionDisplay(BaseCoalMineUnit * pCoalMineUnit);
  virtual void UpdateDataDisplay(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit);
  virtual void ApplyOptions(DWORD dwOptionPagesMask);

protected:
  void CreateGDIResource();
  void DestroyGDIResource();
  void GetMonUnitRect(LPRECT lpRect, int nIndex) const;
  void GetComboBoxRect(LPRECT lpRect) const;
  int GetMonUnitIndexByCursorPos(const CPoint& point, int nAreaFlag = ENTIREAREA) const;
  void GetRealtimeCurveRect(LPRECT lpRect) const;
  RealtimeRecordManager * AppendRealtimeRecordManager(const CString& strMonUnitId) const;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRTCurveDiagramSurface)
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CRTCurveDiagramSurface();

	// Generated message map functions
protected:
	//{{AFX_MSG(CRTCurveDiagramSurface)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	//}}AFX_MSG
  afx_msg void OnSelchangeMonUnit();
  afx_msg void OnPenWidthChanged();
  afx_msg void OnTimeChanged();
  afx_msg void OnRefreshCycleChanged();
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RTCURVEDIAGRAMSURFACE_H__6D01C6B4_5639_4202_B1D7_035B84F5C50F__INCLUDED_)
